package org.gen.pojo.util;

/**
 * Created by zhuge on 2017/10/11.
 */
public class MavenModuleUtil {
    //获取maven根目录
    public static String getModuleRootPath(){
        String path = MavenModuleUtil.class.getResource(".").getPath();
        return path.substring(0,path.indexOf("target"));
    }
    public static void main(String[] args) {
        /**
         *
         * /C:/apache/pinyougou/pinyougouparent/generatePinyougou/
         */
        String path = MavenModuleUtil.getModuleRootPath();
        System.out.println(path);
        System.out.println(System.getProperty("user.dir"));
        // 获得项目根目录的绝对路径
        System.out.println(System.getProperty("java.class.path")) ;   //得到类路径和包路径
    }
}
